import {getArea} from "@/api/api"

export default {
  data() {
    return {
      provinceList: [],
      cityList: []
    }
  },
  async created() {
    let params = {
      level: 1,
    }
    const result = await getArea(params);
    if (result.code === 0) {
      this.provinceList = result.list
    }
  },
  methods: {
    async handleCity(id) {
      let params = {
        level: 2,
        pid: id
      }
      const result = await getArea(params);
      if (result.code === 0) {
        this.cityList = result.list
      }
    }
  }
}